home *** CD-ROM | disk | FTP | other *** search
- TABLE OF CONTENTS
-
- cx.lib/ArgArrayDone
- cx.lib/ArgArrayInit
- cx.lib/ArgInt
- cx.lib/ArgString
- cx.lib/CxCustom
- cx.lib/CxDebug
- cx.lib/CxFilter
- cx.lib/CxSender
- cx.lib/CxSignal
- cx.lib/CxTranslate
- cx.lib/CxTypeFilter
- cx.lib/HotKey
- cx.lib/InvertString
- cx.lib/ArgArrayDone cx.lib/ArgArrayDone
-
- NAME ArgArrayDone() --- SCANNED LIBRARY
-
- ArgArrayDone();
-
- void ArgArrayDone(void);
-
- DESCRIPTION
- This function closes the disk object and Icon Library opened
- by ArgArrayInit(). Don't call this until you are done using
- the ToolTypes argument strings.
-
- DIAGNOSTICS
- None.
-
- SEE ALSO
- ArgArrayInit()
-
- cx.lib/ArgArrayInit cx.lib/ArgArrayInit
-
- NAME ArgArrayInit -- SCANNED LIBRARY
-
- ttypes = ArgArrayInit(argc, argv);
-
- char **ArgArrayInit(int,char **);
-
- DESCRIPTION
- This function is not part of "commodities.library," but is
- in "cx.lib."
-
- ArgArrayInit() returns a null-terminated array
- of strings suitable for sending to the icon.library function
- FindToolType(). This array will be the ToolTypes array of the
- program's icon, if it was started from the workbench. It will
- be just 'argv' if the program was started from the CLI.
-
- NOTE WELL: Your C compiler must null terminate '*argv[]' for this
- scheme to work.
-
- Pass ArgArrayInit() your startup arguments passed to main().
-
- ArgArrayInit() opens the icon.library (even if the caller was
- started from a CLI, so that the function FindToolType() can
- be used) and may call GetDiskObject(), so clean up is necessary
- when the strings are no longer needed. The function ArgArrayDone()
- does just that.
-
- Use of these routines facilitates the use of ToolTypes or command
- line arguments to control end-user parameters in Commodities
- applications. For example, a filter used to trap a keystroke for
- popping up a window might be created by something like this:
-
- char *ttypes = ArgArrayInit(argc, argv);
- CxObj *filter = UserFilter(ttypes, "POPWINDOW", "alt f1");
-
- ... with ...
-
- CxObj *
- UserFilter(tt, action_name, default_descr)
- char **tt; \* null-terminated (char *(*)[]) *\
- char *action_name; \* name of your semantic action *\
- char *default_descr; \* used if user doesn't provide *\
- {
- char *desc;
-
- desc = FindToolType(tt, action_name);
-
- return ( CxFilter(desc? desc: default_descr) );
- }
-
- In this way the user can assign "alt f2" to the action by
- entering a tooltype in the programs icon of the form:
-
- POPWINDOW=alt f2
-
- or by starting the program from the CLI with like so:
-
- myprogram "POPWINDOW=alt f2"
-
- DIAGNOSTICS
- ArgArrayInit() would return NULL if any problems occured.
-
- SEE ALSO
- ArgArrayDone()
- ArgString()
- ArgInt()
- icon.library/FindToolType()
- cx_support.lib probably will have UserFilter().
-
- cx.lib/ArgInt cx.lib/ArgInt
-
- NAME ArgInt() --- SCANNED LIBRARY
-
- value = ArgInt(tt, string, defaultval)
-
- int ArgInt(char **,char *,int);
-
- DESCRIPTION
- This function looks in the ToolTypes array 'tt' returned
- by ArgArrayInit() for the entry for 'string' and returns
- the "value" for 'string.' The entry and value have the
- standard ToolTypes format such as:
-
- ENTRY=Value
-
- In the case of this function, value will be passed through
- 'atoi()' before returning.
-
- If an entry for 'string' is not found, the integer 'defaultval'
- will be returned.
-
- DIAGNOSTICS
- None.
-
- SEE ALSO
- ArgArrayInit()
-
- cx.lib/ArgString cx.lib/ArgString
-
- NAME ArgString() --- SCANNED LIBRARY
-
- string = ArgString(tt, string, defaultstring)
-
- char *ArgString(char **,char *,char *);
-
- DESCRIPTION
- This function looks in the ToolTypes array 'tt' returned
- by ArgArrayInit() for the entry for 'string' and returns
- the "value" for 'string.' The entry and value have the
- standard ToolTypes format such as:
-
- ENTRY=Value
-
- If an entry for 'string' is not found, the defaultstring
- will be returned.
-
- DIAGNOSTICS
- None.
-
- SEE ALSO
- ArgArrayInit()
-
- cx.lib/CxCustom cx.lib/CxCustom
-
- NAME CxCustom() -- MACRO
-
- custom = CxCustom(action, id);
-
- CxObj *CxCustom(LONG(*)(),LONG);
- LONG (*action)();
-
- DESCRIPTION
- This function creates a custom Commodities object. The action
- of this object on receiving a Commodities message is to
- call a function of the application programmer's choice.
-
- The function provided ('action') will be passed a pointer to
- the actual commodities message (in commodities private data
- space), and will actually execute as part of the input handler
- system task. Among other things, the value of 'id' can be
- recovered from the message by using the function CxMsgID().
-
- The purpose of this function is two-fold. First, it allows
- programmers to create Commodities Exchange objects with
- functionality that was not imagined or chosen for inclusion
- by the designers. Secondly, this is the only way to act
- synchronously with Commodities.
-
- For further explanation and examples, consult the Reference
- Manual.
-
- This function is a C-language macro for CreateCxObj(), defined
- in "cxfunctions.h."
-
- DIAGNOSTICS
- Returns NULL if the custom object cannot be created.
-
- SEE ALSO
- CreateCxObj()
- Custom Objects (in Reference Manual)
- CxMsgID()
-
- cx.lib/CxDebug cx.lib/CxDebug
-
- NAME CxDebug() -- MACRO
-
- debugger = CxDebug(id);
-
- CxObj *CxDebug(LONG);
-
- DESCRIPTION
- This function creates a Commodities debug object. The action
- of this object on receiving a Commodities message is to
- print out information about the Commodities message through
- the Serial port (using the kprintf() routine). The value
- 'id' will also be displayed.
-
- Note that this is a synchronous occurence (the printing
- is done by the input device task). If screen or file
- output is desired, using a sender object instead of
- debug object is necessary, since such output is best
- done by your application process.
-
- This function is a C-language macro for CreateCxObj(), defined
- in "cxfunctions.h."
-
- DIAGNOSTICS
- Returns NULL if the debug object cannot be created.
-
- SEE ALSO
- CreateCxObj()
- CxSender()
- exec_support/kprintf()
-
- cx.lib/CxFilter cx.lib/CxFilter
-
- NAME CxFilter() -- MACRO
-
- filter = CxFilter(description);
-
- CxObj *CxFilter(BYTE *);
-
- DESCRIPTION
- Creates an input event filter object which matches Commodities
- Input Messages fitting the 'description' string. If
- 'description' is NULL, the filter will not match any messages.
-
- A filter may be modified by the functions SetFilter(), using
- a description string, and SetFilterIX(), which takes a
- binary Input Expression as a parameter.
-
- This function is a C-language macro for CreateCxObj(), defined
- in "cxfunctions.h."
-
- DIAGNOSTICS
- Returns NULL if the function fails, which only occurs
- if there is no memory for the new filter object. If there
- is a problem in the description string, the internal error
- code of the filter object will be set to so indicate. This
- error code may be interrogated using the function CxObjError().
-
- SEE ALSO
- CreateCxObj()
- SetFilter(), SetFilterIX(), CxObjError()
- Objects and Message (in Reference Manual)
- Input Expressions and Description Strings
- Objects and Messages (in Reference Manual)
- Error Handling (in Reference Manual)
-
- cx.lib/CxSender cx.lib/CxSender
-
- NAME CxSender() -- MACRO
-
- sender = CxSender(port, id)
-
- CxObj *CxSender(struct MsgPort *,LONG);
-
- DESCRIPTION
- This function creates a Commodities sender object. The action
- of this object on receiving a Commodities message is to
- copy the Commodities message into a standard Exec Message,
- to put the value 'id' in the message as well, and to send the
- message off to the Message Port 'port.'
-
- The value 'id' is used so that an application can monitor
- messages from several senders at a single port. It can
- be retrieved from the Exec message by using the function
- CxMsgID(). The value can be a simple integer ID, or a pointer
- to some application data structure, for example.
-
- Note that Exec messages sent by sender objects arrive
- asynchronously at the destination port. Do not assume
- anything about the status of the Commodities message which
- was copied into the Exec message you received.
-
- All Exec messages sent to your ports must be replied.
- Messages may be replied after the sender object has been
- deleted.
-
- This function is a C-language macro for CreateCxObj(), defined
- in "cxfunctions.h."
-
- DIAGNOSTICS
- Returns NULL if the sender object cannot be created.
-
- SEE ALSO
- CreateCxObj()
- exec.library/PutMsg(), exec.library/ReplyMsg()
- CxMsgID()
-
- cx.lib/CxSignal cx.lib/CxSignal
-
- NAME CxSignal() -- MACRO
-
- signaler = CxSignal(task, signal);
-
- CxObj *CxSignal(struct Task *,LONG);
-
- DESCRIPTION
- This function creates a Commodities signal object. The action
- of this object on receiving a Commodities message is to
- send the 'signal' to the 'task.' The caller is responsible
- for allocating the signal and determining the proper task ID.
-
- Note that 'signal' is the signal value as returned by
- AllocSignal() (example: 3) , not the mask made from
- that value (i.e., not binary 0000000000001000).
-
- This function is a C-language macro for CreateCxObj(), defined
- in "cxfunctions.h."
-
- DIAGNOSTICS
- Returns NULL if the object could not be created.
-
- SEE ALSO
- CreateCxObj()
- Objects and Messages (in Reference Manual)
- exec.library/Signal(), exec.library/AllocSignal(),
- exec.library/FindTask()
-
- cx.lib/CxTranslate cx.lib/CxTranslate
-
- NAME CxTranslate() -- MACRO
-
- translator = CxTranslate(ie);
-
- CxObj *CxTranslate(struct InputEvent *);
-
- DESCRIPTION
- This function creates a Commodities 'translate' object.
- The action of this object on receiving a Commodities
- message is to replace that message in the commodities network
- with a chain of Commodities input messages.
-
- One new Commodities input message for each input event
- in the linked list starting at 'ie' (and NULL terminated).
- The routing information of the new input messages will be
- copied from the input message they replace.
-
- The linked list of input events associated with a translate
- object can be changed using the SetTranslate() function.
-
- If 'ie' is NULL, the null translation occurs: that is, the
- original commodities input message is disposed, and no
- others are created to take its place.
-
- This function is a C-language macro for CreateCxObj(), defined
- in "cxfunctions.h."
-
- DIAGNOSTICS
- Returns NULL if the translate object cannot be created.
-
- SEE ALSO
- CreateCxObj()
- SetTranslate()
- Commodities Input Messages and Filters
-
- cx.lib/CxTypeFilter cx.lib/CxTypeFilter
-
- NAME CxTypeFilter() -- MACRO
-
- typef = CxTypeFilter(typemask);
-
- CxObj *CxTypeFilter(LONG);
-
- DESCRIPTION
- Creates a Commodities Object similar to CxFilter(), but one
- that diverts all Commodities messages whose type, which is
- always a power of two, matches a bit set in 'typemask.'
-
- Values of message types are given in "cxusr.h."
-
- This function is a C-language macro for CreateCxObj(), defined
- in "cxfunctions.h."
-
- DIAGNOSTICS
- Returns NULL if the function fails, which only occurs
- if there is no memory for the new filter object. If there
- is a problem in the description string, the internal error
- code of the filter object will be set to so indicate. This
- error code may be interrogated using the function CxObjError().
-
- SEE ALSO
- CreateCxObj()
- SetFilter(), SetFilterIX(), CxObjError()
- Object and Messages (in Reference Manual)
- Input Expressions and Description Strings
- Error Handling
-
- cx.lib/HotKey cx.lib/HotKey
-
- NAME HotKey() -- SCANNED LIBRARY
-
- filter = Hotkey(descr, port, ID);
-
- CxObj *HotKey(char *,struct MsgPort *,LONG);
-
- DESCRIPTION
- This function is not part of "commodities.library," but
- is in the scanned library cx_support.lib. It creates
- a triad of Commodities objects to accomplish a high-level
- function.
-
- The three objects are a filter, which is created to match
- by the call CxFilter(descr), a sender created by the call
- CxSender(port, ID), and a translator which is created by
- CxTranslate(NULL), so that it swallows any Commodities
- input event messages that are passed down by the filter.
-
- This is the simple way to get a message sent to your program
- when the user performs a particular input action.
-
- It is strongly recommended that the ToolTypes environment
- be used to allow the user to specify the input descriptions
- for your application's hotkeys.
-
- DIAGNOSTICS
- Returns NULL and cleans up after itself if any problems occur
- creating the objects. It may be wise to test filter using
- CxObjError() to insure that 'descr' was a valid description.
-
- SEE ALSO
- ToolTypes and the Commodities Environment (in Reference Manual)
- CxFilter(), CxSender(), CxTranslate(), CxObjError()
-
- cx.lib/InvertString cx.lib/InvertString
-
- NAME InvertString() -- SCANNED LIBRARY
-
- event =InvertString(str, km)
-
- struct InputEvent *InvertString(UBYTE *,CPTR *);
-
- DESCRIPTION
- This function returns a linked list of input events which would
- translate into the string using the keymap 'km' (of the system
- default keymap if 'km' is NULL).
-
- The null-terminated 'str' may contain:
- -ANSI character codes
- -backslash escaped characters:
- \n - return
- \r - return
- \t - tab
- \0 - don't use this, ok?
- \\ - backslash
- -a text description of an input event as used by ParseIX(),
- enclosed in angle brackets.
-
- An example is:
- abc<alt f1>\nhi there.
-
- NOTE: you are responsible for freeing the InputEvents that this
- function allocates. You may use FreeIEvents().
-
- DIAGNOSTICS
- Returns NULL if there is a problem, most often an illegal description
- enclosed in angles.
-
- SEE ALSO
- ParseIX()
- FreeIEvents()
-
-